//
//  ljjiftTableView.ljjift
//  AiTouYun
//
//  Created by liujunjie on 2018/9/15.
//  Copyright © 2018年 junjie.liu. All rights reserved.
//

import UIKit

public extension  LJJViewChainable where Self: UITableView {
    
    @discardableResult
    public func ljj_normalConfig(_ normalConfig: (Self)->Void) ->Self {
        if #available(iOS 11.0, *) {
            self.contentInsetAdjustmentBehavior = .never
        } else {
            self.translatesAutoresizingMaskIntoConstraints = false
        }
        self.estimatedRowHeight = 0;
        self.estimatedSectionHeaderHeight = 0;
        self.estimatedSectionFooterHeight = 0;
        self.separatorStyle = .none;
        self.backgroundColor = UIColor.white;
        self.allowsSelection = false;
        #if swift(>=4.2)
        self.rowHeight = UITableView.automaticDimension;
        #else
        self.rowHeight = UITableViewAutomaticDimension;
        #endif
        return self
    }
}


public extension UITableView {
    
    @discardableResult
    public func ljj_registerClass(_ array : Array<AnyClass>) -> UITableView {
  
        for (_,value) in array.enumerated() {
           self.register(value, forCellReuseIdentifier: value.description())
        }
        return self
    }
}
